<?php

class UserAndGroupSearchList extends DBList {
	
	protected $dbTable = "tblSecurityUser";
	protected $rowClassType = "UserAndGroupSearchListItem";
	
	public function SearchByString($s) {
		
		$sql = "SELECT * 
				FROM (
					( 
						SELECT pkSecurityUser AS 'id', realname AS 'name', uname, email, isActive, realname, description, validTo, 'User' AS type 
					  	FROM tblSecurityUser 
					  	WHERE uname LIKE '%$s%' OR email LIKE '%$s%' OR realname LIKE '%$s%' OR description LIKE '%$s%' 
					)
					UNION ALL
					(
						SELECT pkSecurityGroup, title AS 'name', title, '-', '-', '1', description, '-', 'Group' AS type 
						FROM tblSecurityGroup
						WHERE title LIKE '%$s%' OR description LIKE '%$s%'
					)
				) AS c ORDER BY c.name";
		
		$this->execute($sql);
	}
	
}

class UserAndGroupSearchListItem extends DBListItem {
	
}


?>